﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common.Infrastructure
{
    /// <summary>
    /// 编号异常.
    /// </summary>
    public class CodeException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CodeException"/> class.
        /// </summary>
        public CodeException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeException"/> class.
        /// </summary>
        /// <param name="message">信息.</param>
        public CodeException(string message)
            : this(string.Empty, message, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeException"/> class.
        /// </summary>
        /// <param name="code">编号.</param>
        /// <param name="message">信息.</param>
        public CodeException(string code, string message)
            : this(code, message, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeException"/> class.
        /// </summary>
        /// <param name="message">信息.</param>
        /// <param name="innerException">内嵌异常对象.</param>
        public CodeException(string message, Exception innerException)
            : this(string.Empty, message, innerException)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeException"/> class.
        /// </summary>
        /// <param name="code">编号.</param>
        /// <param name="message">信息.</param>
        /// <param name="innerException">内嵌异常对象.</param>
        public CodeException(string code, string message, Exception innerException)
            : base(message, innerException)
        {
            this.Code = code;
        }

        /// <summary>
        /// Gets or sets 异常编号.
        /// </summary>
        public string Code { get; set; }
    }
}
